//? 时间戳实现
function da(time) {
    const t = Date.now()
    while (Date.now() < time + t) {

    }
    console.log("醒了")
}

// da(3000)

//? Promise实现 比时间戳实现重要
function dap(time) {
    return new Promise(resolve => {
        setTimeout(() => {
            resolve('done')
        },time)
    })
}
dap(3000).then(res => console.log(res))
